<template>
  <div>
    {{ list }}
  </div>
  <div>
    {{ page }}
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { Api } from '@/types/local/Api'
import type { R, PageBean, PageVO, TbClass } from '@/types/local/R'

const page = ref({
  pageSize: 10,
  pageNumber: 1,
} as PageBean)

const list = ref([] as Array<TbClass>)

const queryInfo = ref({ cname: '' })

const query = () => {
  Api.get(
    `/class/${page.value.pageNumber}/${page.value.pageSize}`,
    queryInfo.value,
    (data: R<PageVO<TbClass>>) => {
      if (data.success) {
        list.value = data.data.list
        page.value = data.data.pageBean
        return
      }
      alert(data.message)
    },
  )
}

onMounted(() => {
  query()
})
</script>

<style scoped></style>
